import wx
from modules import meide as ui

class SerialPanel(wx.Panel):
    def __init__(self, parent, obj):
        wx.Panel.__init__(self, parent)
        
        sizer1 = ui.SimpleGrid().create(self, 'widget').auto_layout()
        
        value = isinstance(obj.port, int) and ("COM%d" % obj.port) or obj.port
        sizer1.add(tr('Port'), ui.Text(value, style = wx.TE_READONLY))
        sizer1.add(tr('Baud Rate'), ui.Text("%d" % obj.baudrate, style = wx.TE_READONLY))
        sizer1.add(tr('Byte Size'), ui.Text("%d" % obj.bytesize, style = wx.TE_READONLY))
        sizer1.add(tr('Parity'), ui.Text(obj.parity, style = wx.TE_READONLY))
        sizer1.add(tr('Stop Bits'), ui.Text("%d" % obj.stopbits, style = wx.TE_READONLY))